<!DOCTYPE html>
<html><head>
        <meta charset="utf-8">
    <title>学无止境，耐得住寂寞的人最坚强！</title>

    <meta name="description" content="Dashboard">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!--Basic Styles-->
    <link href="__ADMIN__/style/bootstrap.css" rel="stylesheet">
    <link href="__ADMIN__/style/font-awesome.css" rel="stylesheet">
    <link href="__ADMIN__/style/weather-icons.css" rel="stylesheet">

    <!--Beyond styles-->
    <link id="beyond-link" href="__ADMIN__/style/beyond.css" rel="stylesheet" type="text/css">
    <link href="__ADMIN__/style/demo.css" rel="stylesheet">
    <link href="__ADMIN__/style/typicons.css" rel="stylesheet">
    <link href="__ADMIN__/style/animate.css" rel="stylesheet">
    <script src="__ADMIN__/ueditor/ueditor.config.js"></script>
    <script src="__ADMIN__/ueditor/ueditor.all.min.js"></script>
    <script src="__ADMIN__/ueditor/lang/zh-cn/zh-cn.js"></script> 
   
     <script src="__ADMIN__/style/jquery_002.js"></script>
    <script src="__ADMIN__/org/uploadify/jquery.uploadify.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#uploadify").uploadify({
                //指定swf文件
                'swf': '__ADMIN__/org/uploadify/uploadify.swf',
                //后台处理的页面
                'uploader': "{:url('cate/upload')}",
                'progressData' : 'speed',
                //按钮显示的文字
                'buttonText': '上传文件',
                //按钮样式自主选择
                'buttonClass':'btn btn-magenta shiny',
                //设定发送数据的name值
                'fileObjName':'img',
                //显示的高度和宽度，默认 height 30；width 120
                //'height': 15,
                //'width': 80,
                //上传文件的类型  默认为所有文件    'All Files'  ;  '*.*'
                //在浏览窗口底部的文件类型下拉菜单中显示的文本
                'fileTypeDesc': 'Image Files',
                'auto': true,
                'onUploadSuccess' : function(file, data, response) {
                    $("input[name='img']").val(data);  
                    var cateimgsrc="__ADMIN__/uploads/cateimg/"+data;
                    var cateimg="<img height='60' src='"+cateimgsrc+"'>";
                    $("#cateimgdiv").show();
                    $("#cateimg").html(cateimg);
                    }
            });
            $("#uploadify-button").prepend("<i style='padding-right:4px;' class='fa fa-upload'></i>");
            $("#uploadify-button").removeAttr('style');
        });

    </script>
 
</head>
<body>
    <!-- 头部 -->
    {include file="public/header"}
    <!-- /头部 -->
    
    <div class="main-container container-fluid">
        <div class="page-container">
                        <!-- Page Sidebar -->
            {include file="public/left"}
            <!-- /Page Sidebar -->
            <!-- Page Content -->
            <div class="page-content">
                <!-- Page Breadcrumb -->
                <div class="page-breadcrumbs">
                    <ul class="breadcrumb">
                                        <li>
                        <a href="{:url('admin/index/index')}">系统</a>
                    </li>
                                        <li>
                        <a href="{:url('cate/lst')}">栏目管理</a>
                    </li>
                                        <li class="active">编辑栏目</li>
                                        </ul>
                </div>
                <!-- /Page Breadcrumb -->

                <!-- Page Body -->
                <div class="page-body">
                    
<div class="row">
    <div class="col-lg-12 col-sm-12 col-xs-12">
    <form class="form-horizontal" role="form" action="" method="post" enctype="multipart/form-data">
    <input type="hidden" name="id" value="{$data.id}">
    <div class="widget flat radius-bordered">
        
        <div class="widget-body">
            <div class="widget-main ">
                <div class="tabbable">
                    <ul class="nav nav-tabs tabs-flat" id="myTab11">
                        <li class="active">
                            <a data-toggle="tab" href="#home11">
                                基本信息
                            </a>
                        </li>
                        <li >
                            <a data-toggle="tab" href="#profile11">
                                SEO信息
                            </a>
                        </li>
                        <li >
                            <a data-toggle="tab" href="#profile12">
                                栏目内容
                            </a>
                        </li>
                    </ul>

            <div class="tab-content tabs-flat">
                <div id="home11" class="tab-pane active">
                    <div class="form-group">
                            <label for="username" class="col-sm-2 control-label no-padding-right">所属模型</label>
                            <div class="col-sm-6">
                                <select name="model_id" id=""> 
                                    {volist name="modelres" id="model"}         
                                    <option {if condition="$data.model_id eq $model['id']"} selected="selected" {/if} value="{$model.id}">{$model.model_name}</option>
                                    {/volist}
                                </select>                                      
                            </div>
                            <p class="help-block col-sm-4 red">* 必填</p>
                    </div>
                    <div class="form-group">
                            <label for="username" class="col-sm-2 control-label no-padding-right">上级栏目</label>
                            <div class="col-sm-6">
                                <select name="pid" id="">
                                    <option value="0">顶级栏目</option>
                                    {volist name="cateres" id="v"}
                                    <option {if condition="$data.pid eq $v['id']"} selected="selected" {/if}  value="{$v.id}">
                                    <?php if($v['level'] !== 0){ echo '├';}?>
                                    <?php echo str_repeat('-',$v['level']*2)?>{$v.cate_name}</option>
                                    {/volist}
                                </select>                                      
                            </div>
                            <p class="help-block col-sm-4 red">* 必填</p>
                    </div>
                    <div class="form-group">
                            <label for="username" class="col-sm-2 control-label no-padding-right">栏目名称</label>
                            <div class="col-sm-6">
                                <input class="form-control" id="" value="{$data.cate_name}" placeholder="" name="cate_name" required="" type="text">
                            </div>
                            <p class="help-block col-sm-4 red">* 必填</p>
                    </div>

                    <div class="form-group">
                        <label for="username" class="col-sm-2 control-label no-padding-right">隐藏栏目</label>
                        <div class="col-sm-6">
                            <div class="col-xs-4" style="margin-top:8px">
                            <label>
                                <input value="0" {if condition="$data['status'] eq 0"} checked="checked" {/if} name="status" class="checkbox-slider colored-purple" type="checkbox">
                                <span class="text"></span>
                            </label>
                            </div>
                        </div>
                        <p class="help-block col-sm-4 red">* 必填</p>
                    </div>
                    <div class="form-group">
                            <label for="username" class="col-sm-2 control-label no-padding-right">栏目图片</label>
                            <div class="col-sm-6" style="margin-top:4px">
                             <label>
                                <span id="uploadify"></span>
                                <input type="hidden"  name="img" value="{$data.img}">
                            </label>
                            <label >
                                <div id="cancel"  class="uploadify-button btn btn-magenta shiny" style="float: left;margin-left:10px"><span class="uploadify-button-text"><i style="padding-right:4px" class="fa fa-rotate-left"></i>撤销上传</span></div>
                            </label>                      
                            </div>
                    </div>
                    
                    <div class="form-group" id="cateimgdiv" {if condition="$data.img eq ''"} style="display: none;" {/if}>
                        <label for="username" class="col-sm-2 control-label no-padding-right"></label>
                        <div class="col-sm-6" style="margin-top:4px">
                         <label id="cateimg">
                         {if condition="$data.img neq ''"} 
                         <img height="100" src="__ADMIN__/uploads/cateimg/{$data.img}" alt=""> {/if}
                        </label>
                        </div>
                    </div>


                    <div class="form-group">
                        <label for="username" class="col-sm-2 control-label no-padding-right">栏目属性</label>
                        <div class="col-sm-6">
                            <div class="control-group">
                                <div class="radio" style="float:left;margin-left: 5px">
                                    <label>
                                        <input {if condition="$data.cate_attr eq 1"} checked="checked" {/if} name="cate_attr" value="1" type="radio" >
                                        <span class="text">列表页栏目(可发布文章)</span>
                                    </label>
                                </div>
                                <div class="radio" style="float:left;margin-left: 20px">
                                    <label>
                                        <input {if condition="$data.cate_attr eq 2"} checked="checked" {/if} name="cate_attr" value="2"  type="radio" class="inverted">
                                        <span class="text">封面频道栏目</span>
                                    </label>
                                </div>
                                <div class="radio" style="float:left;margin-left: 20px">
                                    <label>
                                        <input {if condition="$data.cate_attr eq 3"} checked="checked" {/if} name="cate_attr" value="3"  type="radio" class="inverted">
                                        <span class="text">外链栏目</span>
                                    </label>
                                </div>
                            </div>
                        </div>
                        <p class="help-block col-sm-4 red">* 必填</p>
                    </div>

                    <div class="form-group">
                            <label for="username" class="col-sm-2 control-label no-padding-right">列表页模板</label>
                            <div class="col-sm-6">
                                <input class="form-control"  value="{$data.list_view}" placeholder="" name="list_view" required="" type="text">
                            </div>
                            <p class="help-block col-sm-4 red">* 必填</p>
                    </div>
                    <div class="form-group">
                            <label for="username" class="col-sm-2 control-label no-padding-right">内容页模板</label>
                            <div class="col-sm-6">
                                <input class="form-control" value="{$data.article_view}" id="cnname" placeholder="" name="article_view" required="" type="text">
                            </div>
                            <p class="help-block col-sm-4 red">* 必填</p>
                    </div>
                    <div class="form-group">
                            <label for="username" class="col-sm-2 control-label no-padding-right">频道页模板</label>
                            <div class="col-sm-6">
                                <input class="form-control" value="{$data.index_view}" id="" placeholder="" name="index_view" required="" type="text">
                            </div>
                            <p class="help-block col-sm-4 red">* 必填</p>
                    </div>
                    <div class="form-group">
                            <label for="username" class="col-sm-2 control-label no-padding-right">外链地址</label>
                            <div class="col-sm-6">
                                <input class="form-control" value="{$data.link}" id="" placeholder="http://" name="link"  type="text">
                            </div>
                            <p class="help-block col-sm-4 red">* 如果为外链类型，请填写链接地址</p>
                    </div>

                </div>

                    <div id="profile11" class="tab-pane">
                       <div class="form-group">
                            <label for="username" class="col-sm-2 control-label no-padding-right">栏目标题</label>
                            <div class="col-sm-6">
                                <input class="form-control" value="{$data.title}"  id="" placeholder="" name="title"  type="text">
                            </div>
                          
                        </div>

                        <div class="form-group">
                            <label for="username" class="col-sm-2 control-label no-padding-right">关键词</label>
                            <div class="col-sm-6">
                                <input class="form-control" id="" value="{$data.keywords}"  placeholder="" name="keywords"  type="text">
                            </div>
                          
                        </div>
                        <div class="form-group">
                            <label for="username" class="col-sm-2 control-label no-padding-right">描述</label>
                            <div class="col-sm-6">
                                <textarea name="desc" id="" cols="66" rows="2">{$data.desc}</textarea>
                            </div>
                         
                        </div>
                    </div>

                    <div id="profile12" class="tab-pane">
                        <div class="col-sm-6">
                            <textarea name="content" id="content">{$data.content}</textarea>
                        </div>
                    </div>
                </div>

                    </div>
                </div>
                <div class="form-group" style="margin-left:10px;">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-default">保存信息</button>
                    </div>
                </div>
            </div>
        </div>
            </div>
    </form>
        </div>
    </div>
</div>

                </div>
                <!-- /Page Body -->
            </div>
            <!-- /Page Content -->
        </div>  
    </div>

        <!--Basic Scripts-->    
    <script src="__ADMIN__/style/bootstrap.js"></script>
    <!--Beyond Scripts-->
    <script src="__ADMIN__/style/beyond.js"></script>
    <script src="__ADMIN__/org/layer/layer.js"></script>
    <script type="text/javascript">

    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    
    UE.getEditor('content',{initialFrameWidth:800,initialFrameHeight:300,});
    $("#cancel").click(function(){
            var cateid={$data.id};
            var imgurl=$("input[name='img']").val();
            if(!imgurl){
                layer.msg('请先上传图片！', {icon: 2});
                return false;
            }
            // if(!confirm('确定要撤销图片吗？')){
            //     return false;
            // }
        layer.confirm('确定要撤销图片吗？', {icon: 3, title:'提示'}, function(index){
                    $("input[name='img']").val('');
                    $("#cateimgdiv").hide();
                    $.ajax({
                    type:"post",
                    dataType:"json",
                    data:{imgurl:imgurl,cateid:cateid},
                    url:"{:url('cate/delimg')}",
                    success:function(data){
                        //alert(data);
                        if(data.status == 0){
                            layer.msg(data.msg, {icon: 6});
                        }else{
                            layer.msg(data.msg, {icon: 5});
                        }
                    }
                    });
          layer.close(index);
        });
            
    }); 
    </script>


</body></html>